"""
 -*- coding: utf-8-*-
 @File: api_base.py
 @Author: chen
 @time: 2023/10/22/ 16:41
"""
import requests

from hogwartsHomework.homework_api_auto.utils.util_log import logger


class BaseApi:
    host = "https://qyapi.weixin.qq.com"
    param = {}

    def send_req(self, method, path, **kwargs):
        url = "".join([self.host, path])
        logger.info(f"接口【{url}】的请求参数：{self.param}")
        resp = requests.request(method, url, params=self.param, **kwargs)
        logger.info(f"接口【{url}】的响应码：{resp.status_code}")
        logger.info(f"接口【{url}】的响应体：{resp.text}")
        return resp
